﻿using System.Collections.Generic;
using Microsoft.Office.Tools.Ribbon;
using TemplateGenerator.Controls;

namespace TemplateGenerator {
	public partial class MainRibbon {
		private void MainRibbon_Load(object sender, RibbonUIEventArgs e) {
            
		}		

		private void GenerateButtonsClick(object sender, RibbonControlEventArgs e) {
            GenerateTemplateWindow generate = new GenerateTemplateWindow();
            generate.Show();
		}

		private void OpenValuesControl(object sender, RibbonControlEventArgs e) {
			EnterValuesControl control = new EnterValuesControl();

            //go to the OnImport method when the EnterValuesControl fires the OnImport event
			control.OnImport += OnImport;
			control.Show();
		} 

		private void OnImport(object sender, Dictionary<string, string> values) {
            //check if any values to import in the document were given
			if (values != null && values.Count > 1)
				GeneratorHandler.FormatDocument(values);
		}

		private void BtnOpenOverview_Click(object sender, RibbonControlEventArgs e) {
			TemplateOverview overview = new TemplateOverview();
			overview.Show(); 
		}

	}
}
